package com.example.mvi_core.model

import android.os.Bundle
import android.os.PersistableBundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity

abstract class BaseActivity:AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        if(getLayoutId()==-1){
            setContentView(getLayoutRootView())
        }else{
            setContentView(getLayoutId())
        }

        initView()
        initData()
        initEvent()
    }
    protected open fun initView(){}
    protected open fun  initData(){}
    protected open fun initEvent(){}
    protected open fun getLayoutId(layout:Int=-1): Int {
        return layout
    }
    abstract fun getLayoutRootView():View?
}